package com.djl.zenithbite.controller.comment;

import com.djl.zenithbite.common.response.BaseResponse;
import com.djl.zenithbite.dto.request.comment.AddCommentRequest;
import com.djl.zenithbite.dto.request.comment.DeleteCommentRequest;
import com.djl.zenithbite.service.comment.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/comment")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @GetMapping("/list")
    public BaseResponse list(){
        return commentService.list();
    }

    @GetMapping("/store/list")
    public BaseResponse storeList(Integer storeId){
        return commentService.storeList(storeId);
    }

    @GetMapping("/product/list")
    public BaseResponse productList(Integer productId){
        return commentService.productList(productId);
    }

    @PostMapping("/add")
    public BaseResponse add(@RequestBody AddCommentRequest request){
        return commentService.add(request);
    }

    @PostMapping("/delete")
    public BaseResponse delete(@RequestBody DeleteCommentRequest request){
        return commentService.delete(request);
    }

}
